package adke.models.powerups.property;

import adke.Util;
import adke.managers.GamePowerupManager;
import adke.models.Player;
import adke.models.powerups.PropertyPowerup;

public class TurnPowerup extends PropertyPowerup
{
    public TurnPowerup(Player owner)
    {
        super(owner);
    }

    public TurnPowerup()
    {
        super();
    }
    
    public void activate()
    {
        if (ACTIVATED) return;
        ACTIVATED = true;
        
        // snelheidsdeviatie die we gaan randomizen
        double deviation = GamePowerupManager.getTurnDeviation();
        double curSpeed = owner.getLine().getTurnSpeed();
        
        double newSpeed = curSpeed;
        
        switch (EFFECT)
        {
            case PropertyPowerup.NEGATIVE_PROPERTY:
            {
                newSpeed = curSpeed - Util.random(deviation);
            }
            
            case PropertyPowerup.POSITIVE_PROPERTY:
            {
                newSpeed = curSpeed + Util.random(deviation);
            }
        }
        
        owner.getLine().setTurnSpeed(newSpeed);
    }
}
